package com.seven.z7.logviewer;

import java.awt.Component;
import java.awt.Graphics;

import javax.swing.JTabbedPane;

/**
 * 
 * @author aprokofjev
 * 
 */
public class ClosableTabbedPane extends JTabbedPane {

    private TabCloseUI mCloseUI;

    public ClosableTabbedPane() {
        mCloseUI = new TabCloseUI(this);
    }

    @Override
    public void paint(Graphics g) {
        super.paint(g);
        mCloseUI.paint(g);
    }

    @Override
    public void addTab(String title, Component component) {
        super.addTab(title + "     ", component);
    }

    public String getTabTitleAt(int index) {
        return super.getTitleAt(index).trim();
    }

    public boolean tabAboutToClose(int tabIndex) {
        return true;
    }

}
